# Maintainer: Michael Zhou <zhoumichaely@gmail.com>
# Contributor: Michael Zhou <zhoumichaely@gmail.com>
pkgname=py3-gevent
pkgver=23.9.0
pkgrel=0
pkgdesc="Python3 library for seamless coroutine-based concurrency"
url="http://gevent.org/"
arch="all"
license="MIT"
depends="
	py3-cffi
	py3-greenlet
	py3-zope-event
	py3-zope-interface
	"
makedepends="
	c-ares-dev
	cython
	file
	libev-dev
	libevent-dev
	libuv-dev
	py3-gpep517
	py3-setuptools
	py3-wheel
	python3-dev
	"
checkdepends="python3-tests py3-objgraph"
subpackages="$pkgname-pyc"
source="https://github.com/gevent/gevent/archive/$pkgver/gevent-$pkgver.tar.gz"
builddir="$srcdir/gevent-$pkgver"
options="!check" # tests fail

replaces="py-gevent" # Backwards compatibility
provides="py-gevent=$pkgver-r$pkgrel" # Backwards compatibility

build() {
	export GEVENTSETUP_EMBED=0
	export GEVENTSETUP_EMBED_LIBEV=0

	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer \
		.dist/gevent*.whl
	.testenv/bin/python3 -m gevent.tests
}

package() {
	export GEVENTSETUP_EMBED=0
	export GEVENTSETUP_EMBED_LIBEV=0

	python3 -m installer -d "$pkgdir" \
		.dist/gevent*.whl

	rm -rf "$pkgdir"/usr/lib/python3*/site-packages/*/tests
}

sha512sums="
270e6cf6c4ea1ce3acf2631d30659dac451b768afadcfa0ae0f74ce8c9297139ffc39e6fe1e642c54d9e5a1b5de2e2294a7eafbad44c83a117fdbcd22039f37f  gevent-23.9.0.tar.gz
"
